package com.dingding.order.facade;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.dingding.common.core.util.JSONUtil;
import com.dingding.order.core.cancel.biz.ICancelOrderService;
import com.dingding.order.dto.cancel.ReqCancelOrderDTO;
import com.dingding.order.service.ICancelOrderFacade;

/** 
 * @ClassName: CancelOrderFacade 
 * @Description: 取消订单服务
 * @author chenwei
 * @date 2016年6月3日 上午10:52:51 
 * @version 叮叮搭车V2.2 
*/
@Component("cancelOrderFacade")
public class CancelOrderFacade implements ICancelOrderFacade {

	@Resource(name = "cancelOrderService")
	private ICancelOrderService cancelOrderService; // 获取附近订单列表接口

	/** 
	 * @Title: cancelOrder 
	 * @Description: 取消订单
	 * @author chenwei
	 * @throws 
	*/
	public String cancelOrder(String requestData) {
		// 将客户端请求JSON转换为请求bean
		ReqCancelOrderDTO reqCancelOrderDTO = JSONUtil.parseObject(requestData, ReqCancelOrderDTO.class);

		return this.cancelOrderService.cancelOrder(JSONUtil.toJSONString(reqCancelOrderDTO));
	}

	/** 
	 * @Title: autoCancelOrder 
	 * @Description: 自动取消订单
	 * @author chenwei
	 * @return void
	 * @throws 
	*/
	public void autoCancelOrder() {

		cancelOrderService.autoCancelOrder();
	}

}
